<?php
class attrtagController extends accessController{
    public static function _right(){
        return array(
            array('TAG管理',1),
            array('TAG属性列表','mylist'),
            array('TAG属性索引','index_part'),
            array('TAG编辑','mod,mod_'),
            array('TAG删除','del'),
        );
    }
	public function s(){
		return array('attrtag');
	}
	public function mod(){
        $id=intval($_GET['id']);
        if($id>0){
            $data=$this->s_0->mod($id);
            if($data){
                include($this->viewer_dir.'attrtag/mod.php');
            }
        }
    }
    public function mod_(){
		$id=intval($_GET['id']);
        if($_POST and $id>0){
            $r=$this->s_0->mod_($_POST,$id);
            autoalert($r[0],$r[1]);
            back();
        }
    }
	public function del(){
		$id=intval($_GET['id']);
        if($id>0){
            $r=$this->s_0->del($id);
            autoalert($r[0],$r[1]);
            back();
        }
	}
	public function index_part(){
		$condition=array();
		$extra='';
		$extra_data=array();

		$tag=trim($_GET['tag']);//
		if($tag){
			$condition['tag']=$tag;
			$extra.=" and `tag` like :tag ";
			$extra_data['tag']="%{$tag}%";
		}
	
	    $return=$this->s_0->index_part($condition,$extra,$extra_data);
		include($this->viewer_dir.'attrtag/index_part.php');
	}
	
	public function mylist(){
	   
		$condition=array();
		$extra='';
		$extra_data=array();
		
		$id=intval($_GET['id']);//
		$id=$id==0?'':$id;
		if($id){
			$condition['id']=$id;
			$extra.=" and `a`.`id`=:id";
			$extra_data['id']=$id;
		}
		
		$arc_id=intval($_GET['arc_id']);//
		$arc_id=$arc_id==0?'':$arc_id;
		if($arc_id){
			$condition['arc_id']=$arc_id;
			$extra.=" and `a`.`arc_id`=:arc_id";
			$extra_data['arc_id']=$arc_id;
		}

		$tag=trim($_GET['tag']);//
		if($tag){
			$condition['tag']=$tag;
			$extra.=" and `a`.`tag` like :tag";
			$extra_data['tag']="%{$tag}%";
		}
	
	    $return=$this->s_0->li($condition,$extra,$extra_data);
		include($this->viewer_dir.'attrtag/mylist.php');
	}
//
}